package Experiment3;

public class CallingCard extends Card {
    private String CardNumber;
    private String PIN;
    public CallingCard(){
        super();
    }
    public CallingCard(String Name, String C,String P){
        super(Name);
        this.CardNumber = C;
        this.PIN = P;
    }
    @Override
    public String format(){
        return super.format()+"CardNumber: "+this.CardNumber+"\n"+"PIN: "+this.PIN;
    }
    @Override
    public String toString(){
        return getClass()+"\n[name="+this.getName()+"]\n"+"[CardNumber="+this.CardNumber+",PIN="+this.PIN+"]\n";
    }
    @Override
    public boolean equals(Object o){
        if(o instanceof CallingCard)
            if(((CallingCard) o).getName()==this.getName()&&((CallingCard) o).CardNumber==this.CardNumber&&((CallingCard) o).PIN==this.PIN)
                return true;
        return false;
    }
}
